import axios from 'axios'

const Axios = axios.create({
    baseURL:'http://localhost:7777',
    timeout:10000
})

//请求拦截
// Axios.interceptors.request.use(function(config){
//     console.log(config);
// })

// Axios.interceptors.response.use(function(res){
//     console.log(res);
// })

function Ajax(req){
    return new Promise(resolve=>{
        Axios.request({
            url:req.url,
            method:req.method,
            data:req.data,
            params:req.params
        }).then(suss=>{
            resolve(suss)
        }).catch(err=>{
            resolve(err)
        })
    })
}

export default Ajax